home *** CD-ROM | disk | FTP | other *** search
- On Sun, 1 Jan 1995, John Carpenter wrote:
-
- > Finally...
- >
- > I have (half) written a paint package, but am experiencing several
- > problems with it. (surprisingly)
- >
- > 1) Can anyone tell me the formula for a parabola? Or preferably, can
- > anyone tell me how to write a curve tool like the one in Deluxe paint?
- >
-
- yup... here is mine from my paint program... it works identical
- to that of DeluxePaints... If you want to understand the Math look
- up Bezier Curves... this one use's a 3-point bezeir curve...
-
- Procedure _BEZIER_BRUSH[PX0,PY0,PX1,PY1,PX2,PY2]
- '
- ' PX0,PY0 --> one end point
- ' PX1,PY1 --> the middle point (normally the current mouse co-ords)
- ' PX2,PY2 --> the other end point
- '
- ' this recomputes the middle point so that the curve actually goes
- ' through the mouse pointer.... obtained from equating cx#=px1 and
- ' cy#=py1 and picking t=0.5 then solving cx,cy for px1,py1.
- '
- ' Note: the 'DRAW_LINE2[]' procedure just draws a line but uses the
- ' current brush the user has selected.
- '
-
- PX1=2*PX1-PX0/2-PX2/2
- PY1=2*PY1-PY0/2-PY2/2
-
- _STEP#=0.1
-
- For T#=0 To 1.0 Step _STEP#
-
- CX#=PX0*(1-T#)^2+PX1*(2*T#*(1-T#))+PX2*T#*T#
- CY#=PY0*(1-T#)^2+PY1*(2*T#*(1-T#))+PY2*T#*T#
-
- N#=T#+_STEP#
-
- CXN#=PX0*(1-N#)^2+PX1*(2*N#*(1-N#))+PX2*N#*N#
- CYN#=PY0*(1-N#)^2+PY1*(2*N#*(1-N#))+PY2*N#*N#
-
- _DRAW_LINE2[CX#,CY#,CXN#,CYN#]
-
- Next
-
- '
- End Proc
-
- I use this as the second step in a 2 step process for drawing
- curves in my paint program... first I call my 'Draw Line' command
- then I call 'Draw Bezeir' command with 2 endpoints of the curve
- obtained from the 'Draw Line' and the middle point coming from
- current mouse co-ords.
-
-
- > 2) What I want to do, for example, is pick up a circle of colour 0 from
- > a background of colour 1 as a BOB, like:
- > ______
- > | __ |<--colour 1
- > | / \ |
- > | \__/<|---colour 0
- > |______|
- >
- > BUT I would like colour 1 to be transparent and NOT colour 0! I found a
- > machine code procedure called MAKE_MASK on an AmosPro Productivity disk
- > and tried to use that in conjunction with NO MASK but without success.
- >
-
- yup I also wrote this for my paint program too! It is included
- in the Amos Procedure Library on Aminet... ( AMINET:dev/amos/ProbLib3.lha
- .. or really close ) I belive its called MAKE_ICONMASK[]... if you don't
- have ftp access I will send the procedure to ya...
-
- this one took me about a week to figure out how to code... I explain
- the algorithm quite well in the procedure...
-
- this is in marp also...
-
-
- > 3) I presume there's no way to REDIM an array is there?
- >
-
- Nope... but you can always you Exec's Alloc routines to dynamicaly
- allocate and free mem...
-
- > 4) Or SET BUFFER within a program? I want to have a list of fonts but,
- > since I don't have a hard drive, I have hardly any. When I gave the
- > program to a friend it said "out of variable space" or something. Do I
- > just whack it up high and hope for the best? If so, is there a way of
- > telling a maximum number of fonts that the buffer would hold? I don't
- > think I can do an interface ActiveList directly from the FONT$() array
- > can I??
- >
-
- I had this exact same problem... I just set a limit to a maxium of
- 500 fonts... I wrote a full Font Requester using Pros Interface Language..
- you can have it if you want it...
-
- marp will let you call reqtools fontrequester easily to get by
- this problem easily...
-
- > 5) Is there a faster version of PLOT and POINT as I'm doing "image
- > processing" (sort of..) in the program and it's REALLY slow. I have
- > seen an image processor I think is in Amos (because you can Ami+A it
- > into Wbench) and it makes mine look foolish by being so fast - how does
- > it do it?
- >
-
- Here you will have to be more specific... if you are doing "real"
- digital image processing (which I only know a little about at the moment
- I have taken a course in Digital Signal Processing (the pre requsite to
- the Imag procressing one) but it is basically 2-d signal processing)...
-
- In the "real" processing... you basically have to convolve a
- filter with a signal... ie. y = x * h (*=convolution (polynomial
- multiplication) or Y=X*H (*=normal multiplication) in the frequency
- domain... I may be taking the 'Image' processing course this semester
- (it depends on whether I can get in) so I may be able to help a bit more
- in a month :)
-
-
-
- > --
- >
- > I think that'll have to do for now, although I'm sure I'll think of some
- > more soon! Sorry about this, I hope you don't mind all this crap.
-
- I don't :)... this is a god way to learn...
-
- > If
- > you can help with any of it I will be incredibly grateful as many of
- > these things have plagued me for AGES!!!
- >
- > Thanks..
- >
-
- your welcome...
-
- mike
-
-
- > --
- > Semprini
- >
- > (Oh yeah...happy new year etc etc..)
- >
-
-